package com.faithbj.common.model.fm.verify;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang3.StringUtils;

import com.faithbj.common.model.fm.FamilyMemberEntity;
import com.faithbj.common.utils.JsonUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;

/**
 * 家庭成员可支配收入证明值
 * 
 * @author yfxue
 * 
 */
@Entity
@Table(name = "FM_INCOME_Proof")
@JsonIgnoreProperties({"selectedProffs"})
public class FamilyMemberIncomeProof extends FamilyMemberEntity {

	private static final long serialVersionUID = 569894097845014866L;
	// 经营性收入-从事经工商和劳动部门登记的经营活动的净收入
	private Double registerIncome;
	// 经营性收入-从事未经工商和劳动部门登记的经营活动的净收入
	private Double unRegisterIncome;

	// 财产性收入-银行存款利息收入
	private Double bankInterestIncome;
	// 财产性收入-基金收益
	private Double fundIncome;
	// 财产性收入-股息与红利收入
	private Double stockIncome;
	// 财产性收入-保险收益
	private Double insuranceIncome;
	// 财产性收入-出租房屋或其他家庭财产收益
	private Double rentalHouseIncome;
	// 财产性收入-知识产品收益
	private Double knowledgeIncome;
	// 财产性收入-其他投资收益
	private Double otherInvestIncome;
	// 财产性收入-其他财产性收益
	private Double otherPropertyIncome;

	// 工资性收入-工资收入
	private Double salaryIncome;
	// 工资性收入-奖金收入
	private Double bonusIncome;
	// 工资性收入-补贴收入
	private Double subsidyIncome;
	// 工资性收入-加班收入
	private Double overtimeIncome;
	// 工资性收入-第二职业收入
	private Double secondEmployIncome;
	// 工资性收入-兼职收入
	private Double partTimeIncome;
	// 工资性收入-零星劳动收入
	private Double otherIncome;
	// 工资性收入-从事农副业生产获得的收入
	private Double agriculteIncome;
	// 工资性收入-集体经济分配收入
	private Double distributeIncome;

	// 转移性收入-失业保险金
	private Double unemployInsurance;
	// 转移性收入-养老金
	private Double pension;
	// 转移性收入-离退休金
	private Double retired;
	// 转移性收入-政府生活救助收入
	private Double assistantIncome;
	// 转移性收入-就业岗位补贴
	private Double jobsSubsidy;
	// 转移性收入-社会保险费补贴
	private Double socialInsuranceSubsidy;
	// 转移性收入-遗属补助金
	private Double survivorsSubsidy;
	// 转移性收入-彩票收益
	private Double lotteryIncome;
	// 转移性收入-赡（抚、扶）养费
	private Double alimony;
	// 转移性收入-辞退金
	private Double dismiss;
	// 转移性收入-赔偿收入
	private Double compensationIncome;
	// 转移性收入-捐赠
	private Double donation;
	// 转移性收入-赠与收入
	private Double giftIncome;
	// 转移性收入-接受遗产收入
	private Double inheritanceIncome;
	// 转移性收入-奖学金
	private Double scholarship;
	// 转移性收入-义务兵自谋职业补助金或退役安置费
	private Double soldierSubsidy;
	// 转移性收入-高温补贴费
	private Double highSubsidy;
	// 转移性收入-取暖补贴费
	private Double heatingSubsidy;
	// 转移性收入-亲友搭伙费
	private Double friendsPartnerFee;
	// 转移性收入-一次性支取的补充养老金
	private Double oneTimeAddPension;
	// 转移性收入-一次性支取的住房公积金（不含补充住房公积金）
	private Double oneTimeHouseFund;
	// 转移性收入-一次性支取的补充住房公积金
	private Double oneTimeAddHouseFund;
	// 转移性收入-其他补贴
	private Double otherSubsidy;
	// 证明材料选择状态保存，json格式存放，getProofMap（"属性名"）可以获取该属性队形的证明材料Id的list
	private String selectedProof;
	

	@Column(name = "unemploy_insurance")
	public Double getUnemployInsurance() {
		return unemployInsurance;
	}
	@Column(name = "pension")
	public Double getPension() {
		return pension;
	}
	@Column(name = "retired")
	public Double getRetired() {
		return retired;
	}
	@Column(name = "assistant_income")
	public Double getAssistantIncome() {
		return assistantIncome;
	}
	@Column(name = "jobs_subsidy")
	public Double getJobsSubsidy() {
		return jobsSubsidy;
	}
	@Column(name = "social_insurance_subsidy")
	public Double getSocialInsuranceSubsidy() {
		return socialInsuranceSubsidy;
	}
	@Column(name = "survivors_subsidy")
	public Double getSurvivorsSubsidy() {
		return survivorsSubsidy;
	}
	@Column(name = "lottery_income")
	public Double getLotteryIncome() {
		return lotteryIncome;
	}
	@Column(name = "alimony")
	public Double getAlimony() {
		return alimony;
	}
	@Column(name = "dismiss")
	public Double getDismiss() {
		return dismiss;
	}
	@Column(name = "compensation_income")
	public Double getCompensationIncome() {
		return compensationIncome;
	}
	@Column(name = "donation")
	public Double getDonation() {
		return donation;
	}
	@Column(name = "gift_income")
	public Double getGiftIncome() {
		return giftIncome;
	}
	@Column(name = "inheritance_income")
	public Double getInheritanceIncome() {
		return inheritanceIncome;
	}
	@Column(name = "scholarship")
	public Double getScholarship() {
		return scholarship;
	}
	@Column(name = "sodier_subsidy")
	public Double getSoldierSubsidy() {
		return soldierSubsidy;
	}
	@Column(name = "high_subsidy")
	public Double getHighSubsidy() {
		return highSubsidy;
	}
	@Column(name = "heating_subsidy")
	public Double getHeatingSubsidy() {
		return heatingSubsidy;
	}
	@Column(name = "friends_partner_fee")
	public Double getFriendsPartnerFee() {
		return friendsPartnerFee;
	}
	@Column(name = "one_time_add_pension")
	public Double getOneTimeAddPension() {
		return oneTimeAddPension;
	}
	@Column(name = "one_time_house_fund")
	public Double getOneTimeHouseFund() {
		return oneTimeHouseFund;
	}
	@Column(name = "one_time_add_house_fund")
	public Double getOneTimeAddHouseFund() {
		return oneTimeAddHouseFund;
	}
	@Column(name = "other_subsidy")
	public Double getOtherSubsidy() {
		return otherSubsidy;
	}
	@Column(name = "salary_income")
	public Double getSalaryIncome() {
		return salaryIncome;
	}
	@Column(name = "bonus_income")
	public Double getBonusIncome() {
		return bonusIncome;
	}
	@Column(name = "subsidy_income")
	public Double getSubsidyIncome() {
		return subsidyIncome;
	}
	@Column(name = "overtime_income")
	public Double getOvertimeIncome() {
		return overtimeIncome;
	}
	@Column(name = "sencond_employ_income")
	public Double getSecondEmployIncome() {
		return secondEmployIncome;
	}
	@Column(name = "part_time_income")
	public Double getPartTimeIncome() {
		return partTimeIncome;
	}
	@Column(name = "other_income")
	public Double getOtherIncome() {
		return otherIncome;
	}
	@Column(name = "agriculte_income")
	public Double getAgriculteIncome() {
		return agriculteIncome;
	}
	@Column(name = "distribute_income")
	public Double getDistributeIncome() {
		return distributeIncome;
	}
	@Column(name = "bank_interest_income")
	public Double getBankInterestIncome() {
		return bankInterestIncome;
	}
	@Column(name = "fund_income")
	public Double getFundIncome() {
		return fundIncome;
	}
	@Column(name = "stock_income")
	public Double getStockIncome() {
		return stockIncome;
	}
	@Column(name = "insurance_income")
	public Double getInsuranceIncome() {
		return insuranceIncome;
	}
	@Column(name = "rental_house_income")
	public Double getRentalHouseIncome() {
		return rentalHouseIncome;
	}
	@Column(name = "knowledge_income")
	public Double getKnowledgeIncome() {
		return knowledgeIncome;
	}
	@Column(name = "other_invest_income")
	public Double getOtherInvestIncome() {
		return otherInvestIncome;
	}
	@Column(name = "other_property_income")
	public Double getOtherPropertyIncome() {
		return otherPropertyIncome;
	}
	@Column(name = "register_income")
	public Double getRegisterIncome() {
		return registerIncome;
	}
	@Column(name = "unregister_income")
	public Double getUnRegisterIncome() {
		return unRegisterIncome;
	}
	@Column(name = "selected_proof")
	public String getSelectedProof() {
		return selectedProof;
	}

	
	public void setUnemployInsurance(Double unemployInsurance) {
		this.unemployInsurance = unemployInsurance;
	}
	public void setPension(Double pension) {
		this.pension = pension;
	}
	public void setRetired(Double retired) {
		this.retired = retired;
	}
	public void setAssistantIncome(Double assistantIncome) {
		this.assistantIncome = assistantIncome;
	}
	public void setJobsSubsidy(Double jobsSubsidy) {
		this.jobsSubsidy = jobsSubsidy;
	}
	public void setSocialInsuranceSubsidy(Double socialInsuranceSubsidy) {
		this.socialInsuranceSubsidy = socialInsuranceSubsidy;
	}
	public void setSurvivorsSubsidy(Double survivorsSubsidy) {
		this.survivorsSubsidy = survivorsSubsidy;
	}
	public void setDismiss(Double dismiss) {
		this.dismiss = dismiss;
	}
	public void setAlimony(Double alimony) {
		this.alimony = alimony;
	}
	public void setCompensationIncome(Double compensationIncome) {
		this.compensationIncome = compensationIncome;
	}
	public void setLotteryIncome(Double lotteryIncome) {
		this.lotteryIncome = lotteryIncome;
	}
	public void setDonation(Double donation) {
		this.donation = donation;
	}
	public void setGiftIncome(Double giftIncome) {
		this.giftIncome = giftIncome;
	}
	public void setInheritanceIncome(Double inheritanceIncome) {
		this.inheritanceIncome = inheritanceIncome;
	}
	public void setScholarship(Double scholarship) {
		this.scholarship = scholarship;
	}
	public void setSoldierSubsidy(Double soldierSubsidy) {
		this.soldierSubsidy = soldierSubsidy;
	}
	public void setHighSubsidy(Double highSubsidy) {
		this.highSubsidy = highSubsidy;
	}
	public void setHeatingSubsidy(Double heatingSubsidy) {
		this.heatingSubsidy = heatingSubsidy;
	}
	public void setFriendsPartnerFee(Double friendsPartnerFee) {
		this.friendsPartnerFee = friendsPartnerFee;
	}
	public void setOneTimeAddPension(Double oneTimeAddPension) {
		this.oneTimeAddPension = oneTimeAddPension;
	}
	public void setOneTimeHouseFund(Double oneTimeHouseFund) {
		this.oneTimeHouseFund = oneTimeHouseFund;
	}
	public void setOneTimeAddHouseFund(Double oneTimeAddHouseFund) {
		this.oneTimeAddHouseFund = oneTimeAddHouseFund;
	}
	public void setOtherSubsidy(Double otherSubsidy) {
		this.otherSubsidy = otherSubsidy;
	}
	public void setSalaryIncome(Double salaryIncome) {
		this.salaryIncome = salaryIncome;
	}
	public void setBonusIncome(Double bonusIncome) {
		this.bonusIncome = bonusIncome;
	}
	public void setSubsidyIncome(Double subsidyIncome) {
		this.subsidyIncome = subsidyIncome;
	}
	public void setOvertimeIncome(Double overtimeIncome) {
		this.overtimeIncome = overtimeIncome;
	}
	public void setSecondEmployIncome(Double secondEmployIncome) {
		this.secondEmployIncome = secondEmployIncome;
	}
	public void setPartTimeIncome(Double partTimeIncome) {
		this.partTimeIncome = partTimeIncome;
	}
	public void setOtherIncome(Double otherIncome) {
		this.otherIncome = otherIncome;
	}
	public void setAgriculteIncome(Double agriculteIncome) {
		this.agriculteIncome = agriculteIncome;
	}
	public void setDistributeIncome(Double distributeIncome) {
		this.distributeIncome = distributeIncome;
	}
	public void setBankInterestIncome(Double bankInterestIncome) {
		this.bankInterestIncome = bankInterestIncome;
	}
	public void setFundIncome(Double fundIncome) {
		this.fundIncome = fundIncome;
	}
	public void setStockIncome(Double stockIncome) {
		this.stockIncome = stockIncome;
	}
	public void setInsuranceIncome(Double insuranceIncome) {
		this.insuranceIncome = insuranceIncome;
	}
	public void setRentalHouseIncome(Double rentalHouseIncome) {
		this.rentalHouseIncome = rentalHouseIncome;
	}
	public void setKnowledgeIncome(Double knowledgeIncome) {
		this.knowledgeIncome = knowledgeIncome;
	}
	public void setOtherInvestIncome(Double otherInvestIncome) {
		this.otherInvestIncome = otherInvestIncome;
	}
	public void setOtherPropertyIncome(Double otherPropertyIncome) {
		this.otherPropertyIncome = otherPropertyIncome;
	}
	public void setRegisterIncome(Double registerIncome) {
		this.registerIncome = registerIncome;
	}
	public void setUnRegisterIncome(Double unRegisterIncome) {
		this.unRegisterIncome = unRegisterIncome;
	}
	public void setSelectedProof(String selectedProof) {
		this.selectedProof = selectedProof;
	}
	
	
	/**
	 * 证明材料选择状态保存
	 * json格式存放，
	 * getProofMap（"属性名"）可以获取该属性队形的证明材料Id的list
	 * @param properyName 属性名称
	 * @return
	 */
	@Transient
	public List<String> getSelectedProffs(String properyName) {
		if(StringUtils.isNotBlank(this.selectedProof))
		{
			 Map<String,List<String>> selectedMapList=JsonUtil.fromJson(this.selectedProof, Map.class);
			 return selectedMapList.get(properyName);
		}
	 return null;
	}
	/**
	 * 证明材料选择状态保存
	 * json格式存放
	 * getProofMap（"属性名"）可以获取该属性队形的证明材料Id的list
	 * @param properyName 属性名称
	 * @param values 该属性保存的证明材料的ID的数组
	 * @return
	 */
	@Transient
	public void setSelectedProffs(String properyName,String[] values) {
		Map<String, List<String>> selectedMapList = new HashMap<String, List<String>>();
		
		if(StringUtils.isNotBlank(this.selectedProof))
		{
			try {
				selectedMapList = JsonUtil.getMapper().readValue(this.selectedProof, new TypeReference<Map<String,List<String>>>() { });
			} catch (JsonParseException e) {
				e.printStackTrace();
			} catch (JsonMappingException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
			 selectedMapList.put(properyName, Arrays.asList(values));
		}
		else
			selectedMapList.put(properyName, Arrays.asList(values));
		
		this.selectedProof=JsonUtil.toJson(selectedMapList);//赋值
	}
}
